<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>物流小秘税开管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">企业名称</div>
                    <div class="field">
                        <input name="status" id="status" type="hidden" value="${status }">
                        <input name="corpCstNm" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                
                <div class="fieldBox">
                    <div class="label">证件类型</div>
                    <div class="field">
                        <select name="corpCertTypCd" id="corpCertTypCd" ligerui="width: 160">
                            <option value=" "  selected="selected">请选择</option>
                            <option value="20" >企业统一社会信用代码</option>
                            <option value="10">中征码</option>
                        </select>
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">注册证件号码</div>
                    <div class="field">
                        <input name="corpCertNo" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">申请人</div>
                    <div class="field">
                        <input name="operationNm" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">申请人工号</div>
                    <div class="field">
                        <input name="operationCd" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">申请时间</div>
                    <div class="field">
                        <input name="stDt" id="stDt" type="text" class="ui-datepicker" value="">
                        <span>---</span>
                        <input name="endDt" id="endDt" type="text" class="ui-datepicker" value="">
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <%--<span id="addBtn" class="sq-button sq-button-round">新增</span>--%>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null,callback=null;
    var status = $("#status").val();
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/corp/rcwltpmgt/initList.do?status='+ status,
            method: 'get',
            columns: [
		{display: 'ID', name: 'id', minWidth: 180, align: 'left', enabledSort: false},
        {display: '企业名称', name: 'corpCstNm', minWidth: 200, align: 'left', enabledSort: false},
        {display: '证件类型', name: 'corpCertTypCdNm', minWidth: 180, align: 'left', enabledSort: false},
        {display: '证件号码', name: 'corpCertNo', minWidth: 180, align: 'left', enabledSort: false},
		{display: '申请时间', name: 'applyTm', minWidth: 180, align: 'left', render:renderDate, enabledSort:true},
		{display: '耗时', name: 'useTime', minWidth: 180, align: 'left', enabledSort: false},
		{display: '申请人', name: 'operationNm', minWidth: 180, align: 'center', enabledSort: false},
		{display: '申请人工号', name: 'operationCd', minWidth: 100, align: 'center', enabledSort: false},
		{
			display: '操作',minWidth: 200,
			render: function (rowdata, rowindex, value){
                var h = '';
				var h1 = '<sys:funcAuth resCd="rcwltpmgtAddInfo"><a class="sq-button-hasicon" href="javascript:void(0);" onclick="addWlTpMgt('+rowdata.id+')"><i class="sqBtnIco_4"></i>添加税开信息</a></sys:funcAuth>'
				var h2 = '<sys:funcAuth resCd="rcwltpmgtShowInfo"><a class="sq-button-hasicon" href="javascript:void(0);" onclick="wlTpMgt('+rowdata.id+')"><i class="sqBtnIco_4"></i>查看</a></sys:funcAuth>';
                if (status == '1') {
                    h = h1;
                } else if (status == '2') {
                    h = h2;
                }
				return h;
			}
		}
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            //isScroll: false,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
            /* onRenderComplete: function () {
             iframeResize ();
             } */
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });
        
        callback = function () {
            grid.reload();
        };

    });
    function addWlTpMgt(_id) {
        $.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 800,
            height: 780,
            title: '添加税开信息',
            url: '<%=path%>/corp/rcwltpmgt/toModifyPage.do?id=' + _id,
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [{
                text: "保存", type: 'ok', cls: 'l-dialog-btn-ok',
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onOk = function () {}
                    if (Dialog.onOk) {
                        Dialog.onOk(function (flag) {
                            //调用完成操作
                            if (flag == true) {
                                searchBtnEvent();
                                UIUtils.alertSuccess("操作成功!");
                            }
                        });
                    }
                }
            }, {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ]
        });
    }

    function wlTpMgt(_id) {
        $.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 800,
            height: 580,
            title: '税开信息',
            url: '<%=path%>/corp/rcwltpmgt/toDetailPage.do?id=' + _id,
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [ {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ]
        });
    }

    //查询按钮事件
    function searchBtnEvent() {
        var form = new liger.get("searchBar");
        var data = form.getData();
        for (name in data) {
            grid.setParm(name, data[name]);
        }
        grid.reload();
    }

    <%--/* 添加税开信息 */--%>
    <%--function addWlTpMgt(_id){--%>
    	<%--Add_navTab('WlTpMgt_1'+_id, "添加税开信息", '<%=path%>/corp/rcwltpmgt/toModifyPage.do?id='+_id, callback);--%>
    <%--}--%>
    <%--/* 查看 */--%>
    <%--function wlTpMgt(_id){--%>
    	<%--Add_navTab('WlTpMgt_2'+_id, "查看信息", '<%=path%>/corp/rcwltpmgt/toDetailPage.do?id='+_id, callback);--%>
    <%--}--%>

	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}

</script>

</body>
</html>
